package com.xiezc.dao;

import com.xiezc.entity.User;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.SQLUpdate;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Administrator on 2017/5/31.
 */
@Repository
public interface UserRepository extends CrudRepository<User, Integer> {
    User findByUserName(String userName);

    @Transactional
    @Modifying
    @Query("update User a set a.pathSet = :path where a.id = :id")
    void updatePath(@Param("id") int id, @Param("path") String path);
}
